Component({
	data: {
		CurrentClient: wx.getStorageSync('CurrentClient'), //0:用户端；1：师傅端
		selected: 0,
		tabList1: {
			list: [
				{
				Select: 0,
				text: "首页",
				pagePath: "pages/UserHomePage/UserHomePage",
				iconPath: "/static/tabbar/staff/tabbar0.png",
				selectedIconPath: "/static/tabbar/staff/tabbar_0.png",
				mode: 1
			},  {
				Select: 2,
				text: "订单",
				pagePath: "pages/CustomerService/CustomerService",
				iconPath: "/static/tabbar/staff/tabbar2.png",
				selectedIconPath: "/static/tabbar/staff/tabbar_2.png",
				mode: 1
			}, {
				Select: 3,
				text: "我的",
				pagePath: "pages/UserCenter/UserCenter",
				iconPath: "/static/tabbar/staff/tabbar3.png",
				selectedIconPath: "/static/tabbar/staff/tabbar_3.png",
				mode: 1
			}]
		},
		tabList0: {
			list: [{
				Select: 0,
				text: "首页",
				pagePath: "pages/UserHomePage/UserHomePage",
				iconPath: "/static/tabbar/user/tabbar0.png",
				selectedIconPath: "/static/tabbar/user/tabbar_0.png",
				mode: 0
			}, {
				Select: 1,
				text: "地图",
				pagePath: "pages/MapPositioning/MapPositioning",
				iconPath: "/static/tabbar/user/tabbar1.png",
				selectedIconPath: "/static/tabbar/user/tabbar_1.png",
				mode: 0
			}, {
				Select: 2,
				text: "客服",
				pagePath: "pages/CustomerService/CustomerService",
				iconPath: "/static/tabbar/user/tabbar2.png",
				selectedIconPath: "/static/tabbar/user/tabbar2.png",
				mode: 0
			}, {
				Select: 3,
				text: "我的",
				pagePath: "pages/UserCenter/UserCenter",
				iconPath: "/static/tabbar/user/tabbar3.png",
				selectedIconPath: "/static/tabbar/user/tabbar_3.png",
				mode: 0
			}]
		}
	},
	ready() {
		console.log('tabbarready', );
		this.setData({
			CurrentClient: wx.getStorageSync('CurrentClient')
		})
	},
	observers: {
		'CurrentClient': function(subfield) {
			console.log('WXobservers', subfield);
		}
	},
	methods: {
		switchTab: function(e) {
			if (this.data.CurrentClient == 0) {
				wx.setTabBarItem({
					index: 0,
					text: 'text',
					iconPath: '/path/to/iconPath',
					selectedIconPath: '/path/to/selectedIconPath'
				})
			}
			const data = e.currentTarget.dataset;
			const url = data.path;
			wx.switchTab({
				url: `/${url}`
			});
		}
	}
})
